\(\int \cot (c+d x) \sqrt {a+i a \tan (c+d x)} (A+B \tan (c+d x)) \, dx\) [71]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [F]
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 34, antiderivative size = 86 \[ \int \cot (c+d x) \sqrt {a+i a \tan (c+d x)} (A+B \tan (c+d x)) \, dx=-\frac {2 \sqrt {a} A \text {arctanh}\left (\frac {\sqrt {a+i a \tan (c+d x)}}{\sqrt {a}}\right )}{d}+\frac {\sqrt {2} \sqrt {a} (A-i B) \text {arctanh}\left (\frac {\sqrt {a+i a \tan (c+d x)}}{\sqrt {2} \sqrt {a}}\right )}{d} \]

[Out]

-2*A*arctanh((a+I*a*tan(d*x+c))^(1/2)/a^(1/2))*a^(1/2)/d+(A-I*B)*arctanh(1/2*(a+I*a*tan(d*x+c))^(1/2)*2^(1/2)/
a^(1/2))*2^(1/2)*a^(1/2)/d

Rubi [A] (verified)

Time = 0.27 (sec) , antiderivative size = 86, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.176, Rules used = {3681, 3561, 212, 3680, 65, 214} \[ \int \cot (c+d x) \sqrt {a+i a \tan (c+d x)} (A+B \tan (c+d x)) \, dx=\frac {\sqrt {2} \sqrt {a} (A-i B) \text {arctanh}\left (\frac {\sqrt {a+i a \tan (c+d x)}}{\sqrt {2} \sqrt {a}}\right )}{d}-\frac {2 \sqrt {a} A \text {arctanh}\left (\frac {\sqrt {a+i a \tan (c+d x)}}{\sqrt {a}}\right )}{d} \]

[In]

Int[Cot[c + d*x]*Sqrt[a + I*a*Tan[c + d*x]]*(A + B*Tan[c + d*x]),x]

[Out]

(-2*Sqrt[a]*A*ArcTanh[Sqrt[a + I*a*Tan[c + d*x]]/Sqrt[a]])/d + (Sqrt[2]*Sqrt[a]*(A - I*B)*ArcTanh[Sqrt[a + I*a
*Tan[c + d*x]]/(Sqrt[2]*Sqrt[a])])/d

Rule 65

Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> With[{p = Denominator[m]}, Dist[p/b, Sub
st[Int[x^(p*(m + 1) - 1)*(c - a*(d/b) + d*(x^p/b))^n, x], x, (a + b*x)^(1/p)], x]] /; FreeQ[{a, b, c, d}, x] &
& NeQ[b*c - a*d, 0] && LtQ[-1, m, 0] && LeQ[-1, n, 0] && LeQ[Denominator[n], Denominator[m]] && IntLinearQ[a,
b, c, d, m, n, x]

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 214

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-a/b, 2]/a)*ArcTanh[x/Rt[-a/b, 2]], x] /; FreeQ[{a, b},
x] && NegQ[a/b]

Rule 3561

Int[Sqrt[(a_) + (b_.)*tan[(c_.) + (d_.)*(x_)]], x_Symbol] :> Dist[-2*(b/d), Subst[Int[1/(2*a - x^2), x], x, Sq
rt[a + b*Tan[c + d*x]]], x] /; FreeQ[{a, b, c, d}, x] && EqQ[a^2 + b^2, 0]

Rule 3680

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_), x_Symbol] :> Dist[b*(B/f), Subst[Int[(a + b*x)^(m - 1)*(c + d*x)^n, x], x, Tan[e + f*x
]], x] /; FreeQ[{a, b, c, d, e, f, A, B, m, n}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && EqQ[A*b + a*B,
 0]

Rule 3681

Int[(((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)]))/((c_.) + (d_.)*tan[(
e_.) + (f_.)*(x_)]), x_Symbol] :> Dist[(A*b + a*B)/(b*c + a*d), Int[(a + b*Tan[e + f*x])^m, x], x] - Dist[(B*c
 - A*d)/(b*c + a*d), Int[(a + b*Tan[e + f*x])^m*((a - b*Tan[e + f*x])/(c + d*Tan[e + f*x])), x], x] /; FreeQ[{
a, b, c, d, e, f, A, B, m}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && NeQ[A*b + a*B, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {A \int \cot (c+d x) (a-i a \tan (c+d x)) \sqrt {a+i a \tan (c+d x)} \, dx}{a}+(i A+B) \int \sqrt {a+i a \tan (c+d x)} \, dx \\ & = \frac {(a A) \text {Subst}\left (\int \frac {1}{x \sqrt {a+i a x}} \, dx,x,\tan (c+d x)\right )}{d}+\frac {(2 a (A-i B)) \text {Subst}\left (\int \frac {1}{2 a-x^2} \, dx,x,\sqrt {a+i a \tan (c+d x)}\right )}{d} \\ & = \frac {\sqrt {2} \sqrt {a} (A-i B) \text {arctanh}\left (\frac {\sqrt {a+i a \tan (c+d x)}}{\sqrt {2} \sqrt {a}}\right )}{d}-\frac {(2 i A) \text {Subst}\left (\int \frac {1}{i-\frac {i x^2}{a}} \, dx,x,\sqrt {a+i a \tan (c+d x)}\right )}{d} \\ & = -\frac {2 \sqrt {a} A \text {arctanh}\left (\frac {\sqrt {a+i a \tan (c+d x)}}{\sqrt {a}}\right )}{d}+\frac {\sqrt {2} \sqrt {a} (A-i B) \text {arctanh}\left (\frac {\sqrt {a+i a \tan (c+d x)}}{\sqrt {2} \sqrt {a}}\right )}{d} \\ \end{align*}

Mathematica [A] (verified)

Time = 1.11 (sec) , antiderivative size = 79, normalized size of antiderivative = 0.92 \[ \int \cot (c+d x) \sqrt {a+i a \tan (c+d x)} (A+B \tan (c+d x)) \, dx=\frac {\sqrt {a} \left (-2 A \text {arctanh}\left (\frac {\sqrt {a+i a \tan (c+d x)}}{\sqrt {a}}\right )+\sqrt {2} (A-i B) \text {arctanh}\left (\frac {\sqrt {a+i a \tan (c+d x)}}{\sqrt {2} \sqrt {a}}\right )\right )}{d} \]

[In]

Integrate[Cot[c + d*x]*Sqrt[a + I*a*Tan[c + d*x]]*(A + B*Tan[c + d*x]),x]

[Out]

(Sqrt[a]*(-2*A*ArcTanh[Sqrt[a + I*a*Tan[c + d*x]]/Sqrt[a]] + Sqrt[2]*(A - I*B)*ArcTanh[Sqrt[a + I*a*Tan[c + d*
x]]/(Sqrt[2]*Sqrt[a])]))/d

Maple [A] (verified)

Time = 0.37 (sec) , antiderivative size = 72, normalized size of antiderivative = 0.84

method result size
derivativedivides \(\frac {2 a \left (-\frac {\left (i B -A \right ) \sqrt {2}\, \operatorname {arctanh}\left (\frac {\sqrt {a +i a \tan \left (d x +c \right )}\, \sqrt {2}}{2 \sqrt {a}}\right )}{2 \sqrt {a}}-\frac {A \,\operatorname {arctanh}\left (\frac {\sqrt {a +i a \tan \left (d x +c \right )}}{\sqrt {a}}\right )}{\sqrt {a}}\right )}{d}\) \(72\)
default \(\frac {2 a \left (-\frac {\left (i B -A \right ) \sqrt {2}\, \operatorname {arctanh}\left (\frac {\sqrt {a +i a \tan \left (d x +c \right )}\, \sqrt {2}}{2 \sqrt {a}}\right )}{2 \sqrt {a}}-\frac {A \,\operatorname {arctanh}\left (\frac {\sqrt {a +i a \tan \left (d x +c \right )}}{\sqrt {a}}\right )}{\sqrt {a}}\right )}{d}\) \(72\)

[In]

int(cot(d*x+c)*(a+I*a*tan(d*x+c))^(1/2)*(A+B*tan(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

2/d*a*(-1/2*(-A+I*B)*2^(1/2)/a^(1/2)*arctanh(1/2*(a+I*a*tan(d*x+c))^(1/2)*2^(1/2)/a^(1/2))-A/a^(1/2)*arctanh((
a+I*a*tan(d*x+c))^(1/2)/a^(1/2)))

Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 447 vs. \(2 (65) = 130\).

Time = 0.26 (sec) , antiderivative size = 447, normalized size of antiderivative = 5.20 \[ \int \cot (c+d x) \sqrt {a+i a \tan (c+d x)} (A+B \tan (c+d x)) \, dx=\frac {1}{2} \, \sqrt {2} \sqrt {\frac {{\left (A^{2} - 2 i \, A B - B^{2}\right )} a}{d^{2}}} \log \left (-\frac {4 \, {\left ({\left (-i \, A - B\right )} a e^{\left (i \, d x + i \, c\right )} - {\left (i \, d e^{\left (2 i \, d x + 2 i \, c\right )} + i \, d\right )} \sqrt {\frac {{\left (A^{2} - 2 i \, A B - B^{2}\right )} a}{d^{2}}} \sqrt {\frac {a}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}}\right )} e^{\left (-i \, d x - i \, c\right )}}{i \, A + B}\right ) - \frac {1}{2} \, \sqrt {2} \sqrt {\frac {{\left (A^{2} - 2 i \, A B - B^{2}\right )} a}{d^{2}}} \log \left (-\frac {4 \, {\left ({\left (-i \, A - B\right )} a e^{\left (i \, d x + i \, c\right )} - {\left (-i \, d e^{\left (2 i \, d x + 2 i \, c\right )} - i \, d\right )} \sqrt {\frac {{\left (A^{2} - 2 i \, A B - B^{2}\right )} a}{d^{2}}} \sqrt {\frac {a}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}}\right )} e^{\left (-i \, d x - i \, c\right )}}{i \, A + B}\right ) - \frac {1}{2} \, \sqrt {\frac {A^{2} a}{d^{2}}} \log \left (\frac {16 \, {\left (3 \, A a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + A a^{2} + 2 \, \sqrt {2} {\left (a d e^{\left (3 i \, d x + 3 i \, c\right )} + a d e^{\left (i \, d x + i \, c\right )}\right )} \sqrt {\frac {A^{2} a}{d^{2}}} \sqrt {\frac {a}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}}\right )} e^{\left (-2 i \, d x - 2 i \, c\right )}}{A}\right ) + \frac {1}{2} \, \sqrt {\frac {A^{2} a}{d^{2}}} \log \left (\frac {16 \, {\left (3 \, A a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + A a^{2} - 2 \, \sqrt {2} {\left (a d e^{\left (3 i \, d x + 3 i \, c\right )} + a d e^{\left (i \, d x + i \, c\right )}\right )} \sqrt {\frac {A^{2} a}{d^{2}}} \sqrt {\frac {a}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}}\right )} e^{\left (-2 i \, d x - 2 i \, c\right )}}{A}\right ) \]

[In]

integrate(cot(d*x+c)*(a+I*a*tan(d*x+c))^(1/2)*(A+B*tan(d*x+c)),x, algorithm="fricas")

[Out]

1/2*sqrt(2)*sqrt((A^2 - 2*I*A*B - B^2)*a/d^2)*log(-4*((-I*A - B)*a*e^(I*d*x + I*c) - (I*d*e^(2*I*d*x + 2*I*c)
+ I*d)*sqrt((A^2 - 2*I*A*B - B^2)*a/d^2)*sqrt(a/(e^(2*I*d*x + 2*I*c) + 1)))*e^(-I*d*x - I*c)/(I*A + B)) - 1/2*
sqrt(2)*sqrt((A^2 - 2*I*A*B - B^2)*a/d^2)*log(-4*((-I*A - B)*a*e^(I*d*x + I*c) - (-I*d*e^(2*I*d*x + 2*I*c) - I
*d)*sqrt((A^2 - 2*I*A*B - B^2)*a/d^2)*sqrt(a/(e^(2*I*d*x + 2*I*c) + 1)))*e^(-I*d*x - I*c)/(I*A + B)) - 1/2*sqr
t(A^2*a/d^2)*log(16*(3*A*a^2*e^(2*I*d*x + 2*I*c) + A*a^2 + 2*sqrt(2)*(a*d*e^(3*I*d*x + 3*I*c) + a*d*e^(I*d*x +
 I*c))*sqrt(A^2*a/d^2)*sqrt(a/(e^(2*I*d*x + 2*I*c) + 1)))*e^(-2*I*d*x - 2*I*c)/A) + 1/2*sqrt(A^2*a/d^2)*log(16
*(3*A*a^2*e^(2*I*d*x + 2*I*c) + A*a^2 - 2*sqrt(2)*(a*d*e^(3*I*d*x + 3*I*c) + a*d*e^(I*d*x + I*c))*sqrt(A^2*a/d
^2)*sqrt(a/(e^(2*I*d*x + 2*I*c) + 1)))*e^(-2*I*d*x - 2*I*c)/A)

Sympy [F]

\[ \int \cot (c+d x) \sqrt {a+i a \tan (c+d x)} (A+B \tan (c+d x)) \, dx=\int \sqrt {i a \left (\tan {\left (c + d x \right )} - i\right )} \left (A + B \tan {\left (c + d x \right )}\right ) \cot {\left (c + d x \right )}\, dx \]

[In]

integrate(cot(d*x+c)*(a+I*a*tan(d*x+c))**(1/2)*(A+B*tan(d*x+c)),x)

[Out]

Integral(sqrt(I*a*(tan(c + d*x) - I))*(A + B*tan(c + d*x))*cot(c + d*x), x)

Maxima [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 113, normalized size of antiderivative = 1.31 \[ \int \cot (c+d x) \sqrt {a+i a \tan (c+d x)} (A+B \tan (c+d x)) \, dx=-\frac {\sqrt {2} {\left (A - i \, B\right )} \sqrt {a} \log \left (-\frac {\sqrt {2} \sqrt {a} - \sqrt {i \, a \tan \left (d x + c\right ) + a}}{\sqrt {2} \sqrt {a} + \sqrt {i \, a \tan \left (d x + c\right ) + a}}\right ) - 2 \, A \sqrt {a} \log \left (\frac {\sqrt {i \, a \tan \left (d x + c\right ) + a} - \sqrt {a}}{\sqrt {i \, a \tan \left (d x + c\right ) + a} + \sqrt {a}}\right )}{2 \, d} \]

[In]

integrate(cot(d*x+c)*(a+I*a*tan(d*x+c))^(1/2)*(A+B*tan(d*x+c)),x, algorithm="maxima")

[Out]

-1/2*(sqrt(2)*(A - I*B)*sqrt(a)*log(-(sqrt(2)*sqrt(a) - sqrt(I*a*tan(d*x + c) + a))/(sqrt(2)*sqrt(a) + sqrt(I*
a*tan(d*x + c) + a))) - 2*A*sqrt(a)*log((sqrt(I*a*tan(d*x + c) + a) - sqrt(a))/(sqrt(I*a*tan(d*x + c) + a) + s
qrt(a))))/d

Giac [F]

\[ \int \cot (c+d x) \sqrt {a+i a \tan (c+d x)} (A+B \tan (c+d x)) \, dx=\int { {\left (B \tan \left (d x + c\right ) + A\right )} \sqrt {i \, a \tan \left (d x + c\right ) + a} \cot \left (d x + c\right ) \,d x } \]

[In]

integrate(cot(d*x+c)*(a+I*a*tan(d*x+c))^(1/2)*(A+B*tan(d*x+c)),x, algorithm="giac")

[Out]

integrate((B*tan(d*x + c) + A)*sqrt(I*a*tan(d*x + c) + a)*cot(d*x + c), x)

Mupad [B] (verification not implemented)

Time = 8.16 (sec) , antiderivative size = 493, normalized size of antiderivative = 5.73 \[ \int \cot (c+d x) \sqrt {a+i a \tan (c+d x)} (A+B \tan (c+d x)) \, dx=-\frac {2\,A\,\sqrt {a}\,\mathrm {atanh}\left (\frac {16\,A^3\,a^{9/2}\,d\,\sqrt {a+a\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}}}{16\,d\,A^3\,a^5+32{}\mathrm {i}\,d\,A^2\,B\,a^5+16\,d\,A\,B^2\,a^5}+\frac {16\,A\,B^2\,a^{9/2}\,d\,\sqrt {a+a\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}}}{16\,d\,A^3\,a^5+32{}\mathrm {i}\,d\,A^2\,B\,a^5+16\,d\,A\,B^2\,a^5}+\frac {A^2\,B\,a^{9/2}\,d\,\sqrt {a+a\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}}\,32{}\mathrm {i}}{16\,d\,A^3\,a^5+32{}\mathrm {i}\,d\,A^2\,B\,a^5+16\,d\,A\,B^2\,a^5}\right )}{d}+\frac {\sqrt {2}\,\sqrt {-a}\,\mathrm {atan}\left (\frac {4\,\sqrt {2}\,A^3\,{\left (-a\right )}^{9/2}\,d\,\sqrt {a+a\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}}}{8\,d\,A^3\,a^5+8{}\mathrm {i}\,d\,A^2\,B\,a^5+24\,d\,A\,B^2\,a^5-8{}\mathrm {i}\,d\,B^3\,a^5}-\frac {\sqrt {2}\,B^3\,{\left (-a\right )}^{9/2}\,d\,\sqrt {a+a\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}}\,4{}\mathrm {i}}{8\,d\,A^3\,a^5+8{}\mathrm {i}\,d\,A^2\,B\,a^5+24\,d\,A\,B^2\,a^5-8{}\mathrm {i}\,d\,B^3\,a^5}+\frac {12\,\sqrt {2}\,A\,B^2\,{\left (-a\right )}^{9/2}\,d\,\sqrt {a+a\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}}}{8\,d\,A^3\,a^5+8{}\mathrm {i}\,d\,A^2\,B\,a^5+24\,d\,A\,B^2\,a^5-8{}\mathrm {i}\,d\,B^3\,a^5}+\frac {\sqrt {2}\,A^2\,B\,{\left (-a\right )}^{9/2}\,d\,\sqrt {a+a\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}}\,4{}\mathrm {i}}{8\,d\,A^3\,a^5+8{}\mathrm {i}\,d\,A^2\,B\,a^5+24\,d\,A\,B^2\,a^5-8{}\mathrm {i}\,d\,B^3\,a^5}\right )\,\left (B+A\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{d} \]

[In]

int(cot(c + d*x)*(A + B*tan(c + d*x))*(a + a*tan(c + d*x)*1i)^(1/2),x)

[Out]

(2^(1/2)*(-a)^(1/2)*atan((4*2^(1/2)*A^3*(-a)^(9/2)*d*(a + a*tan(c + d*x)*1i)^(1/2))/(8*A^3*a^5*d - B^3*a^5*d*8
i + 24*A*B^2*a^5*d + A^2*B*a^5*d*8i) - (2^(1/2)*B^3*(-a)^(9/2)*d*(a + a*tan(c + d*x)*1i)^(1/2)*4i)/(8*A^3*a^5*
d - B^3*a^5*d*8i + 24*A*B^2*a^5*d + A^2*B*a^5*d*8i) + (12*2^(1/2)*A*B^2*(-a)^(9/2)*d*(a + a*tan(c + d*x)*1i)^(
1/2))/(8*A^3*a^5*d - B^3*a^5*d*8i + 24*A*B^2*a^5*d + A^2*B*a^5*d*8i) + (2^(1/2)*A^2*B*(-a)^(9/2)*d*(a + a*tan(
c + d*x)*1i)^(1/2)*4i)/(8*A^3*a^5*d - B^3*a^5*d*8i + 24*A*B^2*a^5*d + A^2*B*a^5*d*8i))*(A*1i + B)*1i)/d - (2*A
*a^(1/2)*atanh((16*A^3*a^(9/2)*d*(a + a*tan(c + d*x)*1i)^(1/2))/(16*A^3*a^5*d + 16*A*B^2*a^5*d + A^2*B*a^5*d*3
2i) + (16*A*B^2*a^(9/2)*d*(a + a*tan(c + d*x)*1i)^(1/2))/(16*A^3*a^5*d + 16*A*B^2*a^5*d + A^2*B*a^5*d*32i) + (
A^2*B*a^(9/2)*d*(a + a*tan(c + d*x)*1i)^(1/2)*32i)/(16*A^3*a^5*d + 16*A*B^2*a^5*d + A^2*B*a^5*d*32i)))/d